#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
	int maxDistance(vector<int>& nums1, vector<int>& nums2) {
		int len1 = nums1.size();
		int len2 = nums2.size();
		int m = 0;
		int index2 = 0;
		for (int i = 0; i < len1; i++) {
			while (index2 < len2 && nums2[index2] >= nums1[i]) {
				index2++;
			}
			m = max(m, (index2 - 1 - i));
		}
		return m;
	}
};
